package com.fang.gateway.security.handler;

import com.fang.common.common.CommonResult;
import com.fang.common.util.CommonResultUtil;
import com.fang.gateway.security.utils.HandlerUtils;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.server.WebFilterExchange;
import org.springframework.security.web.server.authentication.logout.ServerLogoutSuccessHandler;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;

/**
 * @Description 登出成功处理器
 * @Author Bernie
 * @Date 2024/4/23 10:45
 **/
@Component
public class FluxLogoutSuccessHandler implements ServerLogoutSuccessHandler {

    @Override
    public Mono<Void> onLogoutSuccess(WebFilterExchange exchange, Authentication authentication) {
        CommonResult result = CommonResultUtil.success();
        return HandlerUtils.writeWith(exchange.getExchange(), result);
    }
    
}
